<?xml version="1.0" encoding="iso-8859-1"?>

<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  >

  <xsl:output
    encoding="ISO-8859-1"
    method="html"
    indent="yes"/>


  <xsl:template match="/doc">
    <html>
      <head>
        <title>Index page created by MusicExporter - www.icoat.de/musicexporter</title>
        <link rel="stylesheet" href="resources/style.css" type="text/css"/>
      </head>
      <body>
        <a name="top"></a>

        <h1>Contents</h1>
        <div class="content">
        <table>
        <xsl:for-each select="albums/album">
          <xsl:variable name="album-pos" select="position()"/>

         <tr><td>
           <xsl:if test="cover">
           <a href="#album-{$album-pos}"><img src="{cover/text()}" width="30"/></a>
           </xsl:if>

           </td>
             <td><a href="#album-{$album-pos}"><xsl:if test="string-length(super-title) &gt; 0"><xsl:value-of select="super-title"/> - </xsl:if>
             <xsl:value-of select="title"/></a></td>
         </tr>
        </xsl:for-each>
        </table>
        </div>

        <h1>Albums</h1>
        <xsl:for-each select="albums/album">
          <xsl:variable name="album" select="."/>
          <xsl:variable name="album-pos" select="position()"/>

          <a name="album-{$album-pos}"></a>

          <div class="pagenavi">
           <a href="#top">[top]</a>
          </div>

          <div class="album">
            <table>
              <tr>
                <td class="cell-cover">
           <xsl:if test="cover">
           <a href="{cover}"><img src="{cover}" width="30"/></a></xsl:if>
                </td>

                <td class="cell-tracks">
            <h1>
              <a href="{dir}"><img src="resources/diamond.gif"/></a><xsl:text> </xsl:text><a href="album-{$album-pos}.html"><xsl:value-of select="title"/></a>
            </h1>
            <xsl:if test="same-artist">
              <h2>
                <xsl:if test="selection='c' and same-composer"><xsl:value-of select="same-composer"/> - </xsl:if>
                <xsl:value-of select="same-artist"/>
              </h2>
            </xsl:if>

            <table cellpadding="0" cellspacing="0">
              <xsl:for-each select="file">
                <xsl:variable name="file" select="text()"/>
                <xsl:variable name="file-pos" select="position()"/>

                <xsl:for-each select="/doc/tracks/track[@file=$file]">
                  <tr>
                    <!-- <td><xsl:value-of select="id3/frame[@id='TRCK']/text"/></td> -->
                    <td class="cell-tn"><a href="{$file}" target="play"><img src="resources/play.gif"/></a></td>
                    <td class="cell-tn"><xsl:value-of select="item[@id='Track Number']"/></td>
                    <td class="cell-name"><a href="album-{$album-pos}.html#track-{$file-pos}"><xsl:value-of select="item[@id='Name']"/></a></td>
                    <td class="cell-time"><xsl:value-of select="display-total-time"/></td>
                  </tr>

                  <xsl:if test="not($album/same-artist)">
                    <tr><td></td><td></td><td class="cell-artist"><xsl:value-of select="item[@id='Artist']"/></td></tr>
                  </xsl:if>

                </xsl:for-each>
              </xsl:for-each>
            </table>
              </td></tr>
              </table>
          </div>
        </xsl:for-each>
      </body>
    </html>
  </xsl:template>


</xsl:stylesheet>